================================

Engineer Programming Challenge Problem: Anagram 

Write a socket server for Windows using standard C/C++ APIs that: 


        Launches worker threads to process socket requests 
        Has a listener thread that opens a socket to accept TCP connections on a specified port 
        As connections are received, the listener queues each connection for one of the worker threads 
        Once a worker thread receives a new connection it should: 
	a.        Read up to 100 alphabetical characters (a-z, A-Z) from the socket or until the first non-alphabetical character is encountered 
	b.        Efficiently determine all anagrams of the typed in word given the provided English dictionary in ASCII format.  An anagram is a word or phrase formed by reordering the letters of another word or phrase, such as satin to stain. 
	c.        Send all anagrams for the entered word to the client over the socket, one word per line, each followed by a carriage return line feed. 
NB: 2010/03/24 I changed the '\r\n' into '; ' because the output is easer to read :)
	d.        Terminate the connection to the socket after all anagrams have been sent 

Here are your parameters: 

        You should add appropriate error handling to check for 
unexpected conditions and possible hacking attacks 
        You must use appropriate synchronization 
        You can assume that your program will never terminate or need to be shut down 
        You may determine valid anagrams from the provided text dictionary.   
        You should develop a relatively fast algorithm for locating all relevant anagrams 
        Your program may perform any required initialization (up to 10 seconds of processing) before starting to listen for connections. 

================================
Notes:  

I could probably get most of a minimal solution implented
pretty quickly. However, there are further considerations required for a good software architecture. The project should 

	a) include a test harness
	b) include debugging infrastructure
	c) consist of a reusable C++ class architecture

Architectural plan, and order of implementation

Algorithmic components
    CAnagramSignature -- unique anagram signature for a string
    CAnagramDictionary -- fast search for anagram matches derived from an input word list algorithm: use a unique signature derived from character counts together with an STL map (std::map) to do fast lookup of precomputed lists of anagrams for each signature. Precomputation occurs at word list load time.
    Local unit test for minimal assurance using randomized anagram selection and test
    
Server/Networking component
    CServer -- base class for listening on an IP:port pair and dispatching connections
    CAnagramServer -- class derived from CServer to do our work
    
    CTaskThread -- base class for an event-synchronized "always on" thread
    CAnagramThread -- class derived from CTaskThread to provide input and fill in the virtual callback that does the work
	
    Unit test using a browser to make connections

Test Harness component
    This is for stress-testing performance, synchronization and thread safety
    CWordList -- random-access list of words for tossing at the server
    CRequestThread -- a class derived from CTaskThread for making connections to 
	CAnagramServer and tossing words at it
